<?php
session_start();
include('config.php');
if (isset($_POST['login']))
{
	if (isset($_POST['password']) && $_POST['password'] != "")
	{
		if (isset($_POST['username']) && $_POST['username'] != "")
		{
			$username = strip_tags($_POST['username']);
			$password = md5(strip_tags($_POST['password']));
			for($i = 0; $i < count($login_password); $i++)
			{
				if ($username == $login_username[$i] && $password == $login_password[$i])
				{
					$_SESSION['connect'] = "iets";
					header('Location: index.php');
				}
				else $loginresult = "<br />Wrong username/password.";
			}	
		}
		else $loginresult = "<br />Please enter a username.";
	}
	else $loginresult = "<br />Please enter a password.";
}

if (!isset($_SESSION['connect'])) {
?>
<script type="text/javascript" language="JavaScript">
document.forms['auth'].elements['username'].focus();
</script>
<html>
<head>
<title>
Boxxy Ip logger // LOGIN
</title>
<LINK HREF="style.css" REL="stylesheet" TYPE="text/css">
</head>
<body>
<div id="login">
<table width="250" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<form name="auth" method="post" action="login.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="250"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="password" type="password"></td>
<input name="login" type="hidden">
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right"><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<? if (isset($loginresult)) echo $loginresult; ?>
</div>
</body>
</html>
<?php
}
else
	header('Location: admin.php');
?>
